package com.ja.openchat.ui.login;

import android.content.Intent;
import android.os.Bundle;

import com.ja.openchat.BR;
import com.ja.openchat.R;
import com.ja.openchat.databinding.ActivityLoginByPcBinding;
import com.ja.openchat.viewmodels.LoginByPCViewModel;

import me.goldze.mvvmhabit.base.BaseActivity;

//电脑登陆
public class LoginByPCActivity extends BaseActivity<ActivityLoginByPcBinding, LoginByPCViewModel> {
    String scanContent;

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_login_by_pc;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public void initParam() {
        super.initParam();
        initIntent(getIntent());
    }

    @Override
    protected void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        setIntent(intent);
        initIntent(intent);
    }

    void initIntent(Intent intent) {
        if (intent != null) {
            scanContent = intent.getStringExtra("scanContent");
            if (viewModel != null)
                viewModel.content = scanContent;
        }
    }

    @Override
    public void initData() {
        super.initData();
        viewModel.content = scanContent;
    }
}
